<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>10_局部组件</title>
    <!-- 引入Vue -->
    <script src="../node_modules/vue/dist/vue.js"></script>
</head>

<body>
    <!-- 编写div元素 -->
    <div id="app">
        <son></son>
    </div>
    <template id="tmp">
        <button @click="count++">您点了我{{count}}次</button>
    </template>
    <!-- 编写Vue实例 -->
    <script>
        // 局部组件定义
        const com1 = {
            template: '#tmp',
            data() {
                return {
                    count: 0
                }
            }
        }
        const vm = new Vue({
            // VM
            el: '#app',
            components: {
                // 局部组件名：组件对象
                son: com1
            }
        })
    </script>
</body>

</html>